/**
 * @description vue 配置文件
 */
const path = require("path");
const resolve = (dir) => path.join(__dirname, dir);

module.exports = {
    devServer: {
        open: true,
        overlay: {
            warnings: false,
            errors: true
        },
        proxy: {
            '^/api-wj': {
                // target: "http://192.168.1.114:8997",  //廖东冬
                // target: "http://172.16.0.123:8997",    // 王杰本地172.16.0.133
                // target: "http://172.16.0.133:8997",    // 王杰本地
                // target: "http://172.16.0.121:8997", // 方凯琦
                // target: "http://58.250.63.9:13881/api-prod",  //测试版本
                // target: "http://192.168.1.100:8997", // 刘文俊本地
                target: 'http://192.168.1.26:8088',
                changeOrigin: true,
                pathRewrite: {
                    '^/api-wj': '/'
                }
            },
            '^/api-sit/mock': {
                target: "http://localhost:3001/",
                changeOrigin: true,
                pathRewrite: {
                    '^/api-sit/mock': '/'
                }
            },
            '^/api-s-wj': {
                target: "http://192.168.1.112:8088/",// 吴俊
                changeOrigin: true,
                pathRewrite: {
                    '^/api-s-wj': '/'
                }
            },
            '^/api-yl': {
                target: "http://192.168.1.122:8088/",// 姚林
                changeOrigin: true,
                pathRewrite: {
                    '^/api-yl': '/'
                }
            },
            '^/api-lp': {
                target: "http://192.168.1.103:8088/",// 雷鹏
                changeOrigin: true,
                pathRewrite: {
                    '^/api-lp': '/'
                }
            },
            '^/api-lwj': {
                target: "http://192.168.1.100:8088/",// 刘文俊
                changeOrigin: true,
                pathRewrite: {
                    '^/api-lwj': '/'
                }
            },
            // 192.168.1.100
            // 192.168.1.114
            '^/api-ldd': {
                target: "http://192.168.1.114:8088/",// 廖东东
                changeOrigin: true,
                pathRewrite: {
                    '^/api-ldd': '/'
                }
            },
            '^/api-jzb': {
                target: "http://172.16.0.105:8089",      // 姜忠兵本地
                changeOrigin: true,
                pathRewrite: {
                    '^/api-jzb': '/'
                }
            },
            '^/api-sit': {
                target: "http://192.168.1.26:8088",
                changeOrigin: true,
                pathRewrite: {
                    '^/api-sit': '/'
                }
            },
            
        }
    },
    css: {
         loaderOptions: {
             scss: {
                 additionalData: `@import "~@/assets/css/variables.scss";`
             }
         }
    },
    chainWebpack(config) {
        config.module.rule('svg').exclude.add(path.resolve('src/assets/icons')).end()
        config.module.rule('icons').test(/\.svg$/).include.add(path.resolve('src/assets/icons')).end().use('svg-sprite-loader').loader('svg-sprite-loader').options({
            symbolId: 'icon-[name]'
        }).end()
    },
    configureWebpack() {
        return {
            resolve: {
                alias: {
                  '@': resolve('src'),
                },
            }
        }
    },
    productionSourceMap: false,
}